package com.cskaoyan.javase.oop1._7exercise._1pvz;

/**
 * 僵尸类
 * @since 09:30
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Zombie {
    // 属性
    String name;
    int hp;
    // 攻击力
    int damage;

    // 持有植物类对象的引用,方便交互
    Plant zombieP;

    // 构造器
    public Zombie() {
    }

    public Zombie(String name, int hp, int damage) {
        this.name = name;
        this.hp = hp;
        this.damage = damage;
    }

    // 行为
    public void attack() {
        System.out.println(name + "正在攻击" + zombieP.name);
    }

    public void beAttacked() {
        System.out.println(name + "正在被" + zombieP.name + "攻击!");
        System.out.println("目前," + name + "还剩余" + (hp - zombieP.damage) + "点血量!");
    }

    public void run() {
        System.out.println(name + "正在接近" + zombieP.name);
    }

    public void eat() {
        System.out.println(name + "吃掉了你的脑子,真香!");
    }
}
